<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">还款计划明细</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="left">
                        <p:commandButton id="toggler" type="button" value="展示选择"
                                         style="width: auto;"
                                         icon="ui-icon-calculator"
                                         />
                        <p:columnToggler datasource="BigClueStatDataTable" trigger="toggler"
                                         />
                    </f:facet>
                    <f:facet name="right">
                        <p:commandButton value="导出" icon="fa fa-download"
                                         rendered="#{loanApiOrderRepaymentBean.isNormal() }"
                                         ajax="false">
                            <p:dataExporter type="xls" target="BigClueStatDataTable" fileName="export"/>
                        </p:commandButton>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card">
                            <p:dataTable id="BigClueStatDataTable"
                                         style="width: 100%"
                                         var="record"
                                         value="#{loanApiOrderRepaymentBean.lazyDataModel}"
                                         rows="#{constants:get('ROWS')}"
                                         lazy="true"
                                         paginator="true"
                                         paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                         rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                         emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                         scrollable="true"
                                         scrollWidth="97%"
                                         reflow="true"
                                         selection="#{loanApiOrderRepaymentBean.selectedRecords}"
                                         resizableColumns="true"
                                         >

                                <p:column headerText="期数">
                                    <h:outputText value="#{record.currentPeriod}"/>
                                </p:column>
                                <p:column headerText="账单日">
                                    <h:outputText value="#{record.repayDate}"/>
                                </p:column>
                                <p:column headerText="到期还款日">
                                    <h:outputText value="#{record.planRepayDate}"/>
                                </p:column>
                                <p:column headerText="实际还款日">
                                    <h:outputText value="#{record.realRepayDate}"/>
                                </p:column>
                                <p:column headerText="当前还款状态">
                                    <h:outputText value="未还清" rendered="#{record.repayStatus == 0}"/>
                                    <h:outputText value="已还清" rendered="#{record.repayStatus == 1}"/>
                                </p:column>
                                <p:column headerText="是否逾期">
                                    <h:outputText value="" rendered="#{record.exceedStatus == 0}"/>
                                    <h:outputText value="已逾期" rendered="#{record.exceedStatus == 1}"/>
                                </p:column>
                                <p:column headerText="总金额">
                                    <h:outputText value="#{record.realPayAmount}"/>
                                </p:column>
                                <p:column headerText="本金">
                                    <h:outputText value="#{record.planRepayAmt}"/>
                                </p:column>
                                <p:column headerText="利息">
                                    <h:outputText value="#{record.interestAmt}"/>
                                </p:column>
                                <p:column headerText="服务费/手续费">
                                    <h:outputText value="#{record.serviceFee}"/>
                                </p:column>
                                <p:column headerText="罚息">
                                    <h:outputText value="#{record.overDueFee}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
